package com.liming.order.controller;

import com.liming.common.pojo.vo.order.web.RefundOrderVO;
import com.liming.common.result.LMResult;
import com.liming.order.service.RefundOrderMircoService;
import io.swagger.v3.oas.annotations.Operation;
import lombok.AllArgsConstructor;
import org.springframework.web.bind.annotation.*;

/**
 * @author liming
 * @date 2025/4/14
 */
@RestController
@AllArgsConstructor
@RequestMapping("/service/user-refund-order")
public class UserRefundOrderMircoController {

    private final RefundOrderMircoService refundOrderMircoService;

    @Operation(summary = "查询退款详情 - 用户")
    @GetMapping("refundDetail/{id}")
    public LMResult<RefundOrderVO> refundDetail(@PathVariable("id") Long orderId) {
        return LMResult.success(refundOrderMircoService.refundDetail(orderId));
    }

    @Operation(summary = "退款 -- 订单")
    @GetMapping("refund/{id}")
    public LMResult<Boolean> refund(@PathVariable Long id, @RequestParam String reason) {
        return LMResult.success(refundOrderMircoService.userApplyRefund(id, reason));
    }
}
